package com.xhhospital.servlet;

import com.xhhospital.dao.BrxxDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(name = "DelBrxxServlet",urlPatterns = "/delBrxx")
public class DelBrxxServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");
        PrintWriter out=response.getWriter();
        String id=request.getParameter("jzkh");
        int jzkh=Integer.parseInt(id);
        int sta= BrxxDao.delBrxxByBh(jzkh);
        if(sta>0){
            //重定向,还是转发
            request.getRequestDispatcher("/xiugai2.jsp").forward(request,response);
        }else{
            out.println("错了");
        }
    }
}
